$n = 1;
$dir = "/data1/bsi/bioinf_int/s106381.borawork/data_HTHGU/MayoGAP/mayogap_emerge/clean/test_plink";
while($n<23)
{
	system("mkdir dir_merged$n");
	system("mv merged$n.bed $dir/dir_merged$n");
	system("mv merged$n.bim $dir/dir_merged$n");
	system("mv merged$n.fam $dir/dir_merged$n");
	
	open(WRBUFF,">./scripts/som1$n");
	#$line = "/projects/bsi/gentools/bin/plink --bfile $dir/hapmap_CEU_r23a  --chr $n --make-bed --out $dir/hapmap_CEU_r23a_chr$n\n";
	#print WRBUFF $line;
	#$line = "/projects/bsi/gentools/bin/plink --bfile $dir/exc_fwdStrandResults_new_mayogap_emerge_clean  --chr $n --make-bed --out $dir/exc_fwdStrandResults_new_mayogap_emerge_clean_chr$n\n";
	#print WRBUFF $line;
	#$line  = "/projects/bsi/gentools/bin/plink --bfile $dir/hapmap_CEU_r23a_chr$n --bmerge $dir/exc_fwdStrandResults_new_mayogap_emerge_clean_chr$n.bed $dir/exc_fwdStrandResults_new_mayogap_emerge_clean_chr$n.bim $dir/exc_fwdStrandResults_new_mayogap_emerge_clean_chr$n.fam --make-bed --out $dir/merged$n\n";
	$line = "/projects/bsi/gentools/bin/plink --bfile $dir/dir_merged$n/merged$n --proxy-assoc all\n";
	print WRBUFF $line;
	system("qsub -l h_vmem=10G -V -cwd -q 1-day ./scripts/som1$n");
	$n++;
}
